package com.itheima.网络编程.tcp编程.tcp编程.tcp网络编程;

import java.io.*;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.Scanner;

public class TcpDemo3x {
    public static void main(String[] args) throws IOException {
        ServerSocket ss = new ServerSocket(10000);
        Socket accept = ss.accept();
        BufferedReader br = new BufferedReader(new InputStreamReader(accept.getInputStream()));
        System.out.println(br.readLine());
        System.out.println("========================");
        Scanner sc = new Scanner(System.in);
        OutputStream out = accept.getOutputStream();
        OutputStreamWriter osw = new OutputStreamWriter(out);
        BufferedWriter bw = new BufferedWriter(osw);
        System.out.println("请输入数据:");
        String message = sc.next();
        bw.write(message);
        accept.shutdownOutput();

    }
}
